import Vue from 'vue';
import VueRouter from 'vue-router';
import store from '../store/index';
import * as filters from '../api/filters';
import routes from '../config/routes-pc'
import {
    sync
} from 'vuex-router-sync'
import App from 'src/views/app.vue'
import VueResource from 'vue-resource'
import { facebook, rca, locaionsPlatform  } from 'src/api/util'
import _ from 'lodash'

import 'assets/less/main.less'

// import VueAwesomeSwiper from 'vue-awesome-swiper'
// import MuseUI from 'vue-mobile-io/@websanova/muse-ui-client'
// import 'vue-mobile-io/@websanova/muse-ui-client/dist/muse-ui.css'
// // import { InfiniteScroll, Lazyload } from 'mint-ui';
// import 'mint-ui/lib/style.css';
// import 'assets/less/common.less'

Vue.use(VueRouter)
Vue.use(VueResource)

// Vue.use(MuseUI);
// Vue.use(VueAwesomeSwiper);
// Vue.use(InfiniteScroll);
// Vue.use(Lazyload);

/* loading commpents */
Object.keys(filters).forEach(k => Vue.filter(k, filters[k])) //注册过滤器

Vue.config.devtools = true
Vue.config.silent = false

Vue.prototype._ = _

//路由跳转
const router = new VueRouter({
    routes,
    mode: 'hash',
    base: window.location.pathname ? window.location.pathname : __dirname,
    linkActiveClass: 'router-link-active', //将激活的路由添加一个mui-active类名称
})

router.beforeEach(({
    path
}, from, next) => {
    next()
})
router.afterEach(route => {

})

sync(store, router)

//挂载首页
// new Vue({ router, render: h => h(App) }).$mount('#app')


const app = new Vue({
    router,
    store,
    ...App
})

app.$mount('#myApp')
// store.dispatch('initUserInfo');
// store.dispatch('getShareTird');
// facebook()
rca('app', 'constellation', 'pageview', '新版首页PC', location.href)

store.dispatch('getShareTird', { serverConfig: serverConfig })

// if (serverConfig.mobile) window.location.href = './mobile.php'
locaionsPlatform()